<template>
  <div>
    <template>
      <div>
        <el-table :data="buildingNumberList" border stripe height="860" :summary-method="getSummaries" show-summary
          :header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }">
          <el-table-column prop="" label="单体成本之配套成本分摊计算（三）">
            <template slot-scope="scope">
              <el-table :data="scope.row.list" :show-header="scope.$index === 0" :row-class-name="rowClassName" :header-cell-style="{'text-align':'center'}" :cell-style="{'text-align':'center'}">
                <el-table-column fixed prop="number" label="楼号">
                </el-table-column>
                <el-table-column prop="type_title" label="业态">
                </el-table-column>
                <el-table-column prop="area" label="建筑面积" :formatter="stateFormat">
                </el-table-column>
                <el-table-column prop="dwcb" label="单位成本" :formatter="stateFormat">
                </el-table-column>
                <el-table-column prop="dwsj" label="单位售价" :formatter="stateFormat">
                </el-table-column>
                <el-table-column prop="sold_ratio" label="已售成本占比" :formatter="stateFormat">
                </el-table-column>
                <el-table-column prop="appor_ratio" label="配套分摊比例" :formatter="stateFormat">
                </el-table-column>
                <el-table-column prop="ftptcb" label="分摊配套成本" :formatter="stateFormat">
                </el-table-column>
                <el-table-column prop="a_sum_exclusive" label="分摊非配套成本" :formatter="stateFormat">
                </el-table-column>
                <el-table-column prop="b_sum_exclusive" label="分摊成本合计" :formatter="stateFormat">
                </el-table-column>
                <el-table-column prop="c_sum_exclusive" label="已售成本合计" :formatter="stateFormat">
                </el-table-column>


              </el-table>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </template>
  </div>
</template>

<script>
import calculateApi from '@/api/calculate'

export default {
  data() {
    return {
      calculate_id: '',
      buildingNumberList: []
    }

  },
  methods: {
    getCalculateBuildingNumberList() {
      calculateApi.getCalculateBuildingNumberList(this.calculate_id).then(response => {
        this.buildingNumberList = response.data.list;
      })
    },
    rowClassName({ row, rowIndex }) {
            if (row.type === 6 || row.type === 10) {
                return 'warning-row';
            }
            return '';
        }

  },
  created() {
    var query = this.$route.query;
    if (query.id) {
      this.calculate_id = query.id;
    }

    this.getCalculateBuildingNumberList();
  },
}
</script>

<style>
.el-table .warning-row {
  display: none;
}
</style>